package me.zhengjie.modules.quartz.task;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.quartz.task.pull.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: youqing.yang
 * @Create: 2021/04/23 15:50
 * @Description:
 **/
@Slf4j
@Component
public class ManualPullDateTask {

    @Autowired
    private OrganizationPullTask organizationPullTask;

    @Autowired
    private FirsthandEstatePullTask firsthandEstatePullTask;

    @Autowired
    private PropertyDependentPullTask propertyDependentPullTask;

    @Autowired
    private PropertyRelationPullTask propertyRelationPullTask;

    @Autowired
    private SignContactPullTask signContactPullTask;

    @Autowired
    private PropertyPullTask propertyPullTask;

    public void manualExecute(String jsonParams){
        //部门-经纪人同步
        Long startTime = System.currentTimeMillis();
        organizationPullTask.corporationPullTask(jsonParams);
        Long endTime = System.currentTimeMillis();
        log.info(" manualExecute organizationPullTask end params:{}  costTime:{}ms ", JSON.toJSONString(jsonParams), (endTime - startTime));

        //新房楼盘
        startTime = System.currentTimeMillis();
        firsthandEstatePullTask.corporationPullTask(jsonParams);
        endTime = System.currentTimeMillis();
        log.info(" manualExecute firsthandEstatePullTask end params:{}  costTime:{}ms ", JSON.toJSONString(jsonParams), (endTime - startTime));

        //区域周边
        startTime = System.currentTimeMillis();
        propertyDependentPullTask.corporationPullTask(jsonParams);
        endTime = System.currentTimeMillis();
        log.info(" manualExecute propertyDependentPullTask end params:{}  costTime:{}ms ", JSON.toJSONString(jsonParams), (endTime - startTime));

        //vr视频
        startTime = System.currentTimeMillis();
        propertyRelationPullTask.corporationPullTask(jsonParams);
        endTime = System.currentTimeMillis();
        log.info(" manualExecute propertyRelationPullTask end params:{}  costTime:{}ms ", JSON.toJSONString(jsonParams), (endTime - startTime));

        //电子合同
        startTime = System.currentTimeMillis();
        signContactPullTask.corporationPullTask(jsonParams);
        endTime = System.currentTimeMillis();
        log.info(" manualExecute signContactPullTask end params:{}  costTime:{}ms ", JSON.toJSONString(jsonParams), (endTime - startTime));

        //租售房源
        startTime = System.currentTimeMillis();
        propertyPullTask.corporationPullTask(jsonParams);
        endTime = System.currentTimeMillis();
        log.info(" manualExecute propertyPullTask end params:{}  costTime:{}ms ", JSON.toJSONString(jsonParams), (endTime - startTime));
        log.info("ManualPullDateTask end!");
    }
}
